package com.example.service;

import com.example.entity.User;
import com.example.repository.UserRepository;
import lombok.extern.slf4j.Slf4j;
import org.springframework.boot.ApplicationArguments;
import org.springframework.boot.ApplicationRunner;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.ArrayList;
import java.util.List;

@Slf4j
@Service
public class ForeachService implements ApplicationRunner {

    @Resource
    private UserRepository userRepository;

    @Override
    public void run(ApplicationArguments args) throws Exception {
        List<Integer> list = new ArrayList<>();
        list.add(1);
        //list.add(2);
        List<User> list1 = userRepository.findList(list);
        log.info("list1:{}", list1);
    }
}
